<%@ tag language="java" body-content="empty" %>
<%@taglib prefix="jstl" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@taglib prefix="tiles" uri="http://tiles.apache.org/tags-tiles"%>
<%@taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@taglib prefix="security" uri="http://www.springframework.org/security/tags"%>


<%@attribute name ="code" required="true" %>
<%@attribute name ="path" required="true" %>
<%@attribute name ="items" required="true" type="java.util.Collection" %>
<%@attribute name ="itemLabel" required="false" %>
<%@attribute name ="itemValue" required="false" %>
<%@attribute name ="firstElement" required="false" %>
<%@attribute name ="onchange" required="false" %>

<jstl:if test="${firstElement == null}">
	<jstl:set var="firstElement" value="false"/>
</jstl:if>
<jstl:if test="${itemLabel == null}">
	<jstl:set var="itemLabel" value="title"/>
</jstl:if>
<jstl:if test="${itemValue == null}">
	<jstl:set var="itemValue" value="id"/>
</jstl:if>




<div>
	
	<form:label path="${path}">
		<spring:message code="${code}" />
	</form:label>
	<form:select id="path" path="${path}" onchange="${onchange}">
			<jstl:if test="${firstElement}">
				<form:option value="0" label="----" />
			</jstl:if>
			<form:options items="${items}" itemValue="${itemValue}" itemLabel="${itemLabel}" />
	</form:select>
	<form:errors path="${path}" cssClass="error" />
</div>